<template>
    <div class="sm-workUnpackTopTable">
        <el-table
        ref="receiveTable"
        size="mini"
        :data="resData"
        style="width: 100%"
        highlight-current-row
        @current-change="tableCurrentChange"
        height="190"
        >
        <el-table-column type="index" label="序号1" width="50" :show-overflow-tooltip="true"> </el-table-column>
        <!-- <el-table-column prop="barcode" label="条码"  :show-overflow-tooltip="true"> </el-table-column> -->
        <el-table-column prop="productCode" label="机型" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="batchNo" label="批次" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="startPlaneNo" label="起始架次" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="endPlaneNo" label="结束架次" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="packageCode" label="工作包编号" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="packageName" label="工作包名称" width="150" :show-overflow-tooltip="true" > </el-table-column>
        <el-table-column prop="aoCode" label="AO编号" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="aoName" label="AO名称" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="requiredTime" label="要求时间" width="150" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="state" label="配套状态" :show-overflow-tooltip="true"> </el-table-column>
        <el-table-column prop="remark" label="备注" :show-overflow-tooltip="true"> </el-table-column>
      </el-table>
        <!-- 分页 -->
        <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageNumber"
        :page-sizes="[10,20,50,100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalCount">
        </el-pagination>
    </div>
</template>
<script>
import { smThreeToOne } from "@/utils/api.js";
export default {
    name:'WorkUnpackTopTable',
    data(){
        return {
            // 当前页数
            pageNumber: 1,
            // 数据总个数
            totalCount: 0,
            // 返回的数据数组
            resData: [],
            // 每页数据个数
            pageSize: 20,
            // 确认列表高亮参数
            stableIndex: 0,
        }
    },
    methods:{
        // 选中单条数据
        tableCurrentChange(){
            // 传数据 给 hcx出库 hcx回库
            this.$bus.$emit('smWcHcxInfo',val)
        },
        // 每页条数改变
        handleSizeChange(){
            this.pageSize = val;
            smThreeToOne({
                searchParams:{

                },
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
            });
        },
        // 页数改变
        handleCurrentChange(val) {
            this.pageNumber = val;
            smThreeToOne({
                searchParams:{

                },
                pageParameter: {
                rows: this.pageSize,
                page: this.pageNumber,
                },
            }).then((res) => {
                this.resData = res.data.responseBody.result;
                this.totalCount = res.data.responseBody.pageParameter.totalCount;
            });
        },
    },
    mounted() {
        smThreeToOne({
            searchParams:{

            },
            pageParameter: {
            rows: this.pageSize,
            page: this.pageNumber,
            },
        }).then((res) => {
            console.log('工作包拆包Top表',res)
            this.resData = res.data.responseBody.result;
            this.totalCount = res.data.responseBody.pageParameter.totalCount;
            
        });
  }
}
</script>
<style scoped>
.sm-workUnpackTopTable {
    width: 100%;
    height: 220px;
    text-align: center;
}
</style>